-
-
Notifications
You must be signed in to change notification settings - Fork 482
fix(commands): Option not working with str / ForwardRef annotations #2919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/2919/head:pr-2919
git checkout pr-2919This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord@refs/pull/2919/head |
404889a to
694de67
Compare
Signed-off-by: DA344 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR changes out-of-scope parts and removes certain things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where the Option class in Discord commands did not correctly resolve type annotations when they were provided as string literals or forward references (e.g., param: 'ForwardRefToSomeThing' or when using from __future__ import annotations).
- Adds support for resolving string-based type annotations using a new
resolve_annotationutility - Improves parameter validation by adding proper type hints and using iterators more efficiently
- Updates import statements to include necessary utilities and remove unused imports
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| discord/commands/core.py | Adds string annotation resolution logic, improves type hints, and cleans up imports |
| CHANGELOG.md | Documents the bug fix for string/forward reference annotation parsing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
ping |
|
anyways, it doesnt work with custom classes |
Signed-off-by: Lala Sabathil <[email protected]>
Summary
Option did not correctly resolve the type of an annotation when it was typed like
param: 'ForwardRefToSomeThing'or when usingfrom __future__ import annotations.Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.